<?php
namespace app\admin\model;

use think\Model;
use \think\Db;
use \think\Session;
class Login extends Model
{
	public function login($a,$p){
		$admin=Db::name('admin')->where('admin_loginname',$a)->find();
		if($admin){
				if(md5($p)==$admin['admin_password']){
					Session::set('admin_id',$admin['admin_id']);
					Session::set('admin_name',$admin['admin_name']);
					//$this->redirect("video/index");
					return 3;
				}else{
					//echo "<script>alert('密码错误');</script>";
					return 2;
				}
			}else{
				//echo "<script>alert('用户名不存在');</script>";
				return 1;
			}
	}
}